package com.xn2001.pattern;

import java.io.Serializable;

/**
 * @author 乐心湖
 * @version 1.0
 * @date 2021/11/9 20:17
 */

public class Singleton3 implements Serializable {
    private static Singleton3 INSTANCE = null;
    private Singleton3() {
        System.out.println("private Singleton3()");
    }
    public static synchronized Singleton3 getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new Singleton3();
        }
        return INSTANCE;
    }
    public static void otherMethod() {
        System.out.println("otherMethod()");
    }
}
